<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="formName" required="true"/>
    </cc:interface>
    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <f:view>
            <h:form id="addNewCustomerForm">
                <p:panel header="#{cc.attrs.formName}" >
                    <h:panelGrid columns="3"> 
                        <h:outputText value="Title: " />   
                        <h:selectOneMenu value="#{customerManagerBean.title}">  
                            <f:selectItem itemLabel="Mr" itemValue="Mr" />  
                            <f:selectItem itemLabel="Ms" itemValue="Ms" />   
                        </h:selectOneMenu> <p></p>

                        <h:outputText value="First Name: " />  
                        <p:inputText required="true" requiredMessage="Field is required." 
                                     id="firstName" value="#{customerManagerBean.firstName}">
                        </p:inputText>
                        <h:message styleClass="errorMsg" for="firstName" />
                            
                        <h:outputText value="Last Name: " />
                        <p:inputText required="true" requiredMessage="Field is required." 
                                     id="lastName" value="#{customerManagerBean.lastName}">                     
                        </p:inputText>
                        <h:message styleClass="errorMsg" for="lastName" />
                        
                        <h:outputText value="email: " />
                        <p:inputText required="true" requiredMessage="Field is required." 
                                     id="email" value="#{customerManagerBean.email}">                     
                        </p:inputText>
                        <h:message styleClass="errorMsg" for="email" />
                        
                        <h:outputText value="Company Name: " />
                        <p:inputText required="false"  
                                     id="companyName" value="#{customerManagerBean.companyName}">                     
                        </p:inputText><p></p>
                        
                        <h:outputText value="Job Title: " />
                        <p:inputText required="false"  
                                     id="jobTitle" value="#{customerManagerBean.jobTitle}">                     
                        </p:inputText><p></p>
                        
                        <h:outputText value="Select customer executive to assign customer to: " />
                        <h:selectOneMenu id="customerExecID" value="#{customerManagerBean.customerExecutiveID}" required="true" requiredMessage="Field is required">                            
                            <f:selectItems value="#{systemUserDataTableBean.usersDropList}"/>
                            </h:selectOneMenu>
                        <h:message styleClass="errorMsg" for="customerExecID" />
                        
                        <h:outputText value="Customer Credit Limit: " />
                        <p:inputText required="true" requiredMessage="Field is required." 
                                     id="creditLimit" value="#{customerManagerBean.creditLimit}">                     
                        </p:inputText>
                        <h:message styleClass="errorMsg" for="creditLimit" />
                        

                        <h:commandButton action="saveNewCustomer.xhtml" value="Save New Customer" actionListener="#{customerManagerBean.addCustomer}" />
                    </h:panelGrid> 
                </p:panel>
            </h:form>
        </f:view>
    </cc:implementation>    
</html>